1. Field of the Invention
The present invention relates to the field of computer science, and more particularly to a method and apparatus for renaming identifiers in Java.TM. class files.
2. Background Information
The Java language designed by Sun Microsystems, is a platform independent object-oriented programming language. It is analogous to C++ or Smalltalk in its high-level concepts. As with all programming languages, good design and solid program construction contributes to the maintainability and comprehensibility of program source code.
An important factor of "good design" is using meaningful names for identifiers. In Java, we can define an identifier as the name of any method, class or variable. A method is the name for a Java function or procedure. A method is largely identical to a function except that it has membership in some class, and therefore, a method has the same effective definition as a C++ "member function."
A class is a collection of related fields and methods. From classes we create objects. Therefore, a Java class is largely the same as a C++ or Smalltalk class.
Java variables are analogous to variables in any programming language, although Java classifies its variables into two high-level types: fields and local variables. A field is a variable that is global to a given class and represents the object-oriented concept of the "data" of a class. A local variable is local to a given method and only exists therein.
With the notable exception of local variables, all identifiers are stored after compilation within the Java object files known as "class" files because of their ".class" extension. Given that Java applications can use many of classes, methods and fields, the storage required for storing their names can be significant compared to the total size of the Java class files.
Keeping Java programs small is of increasing importance given that a common way of distributing of Java applications, sometimes referred to as "applets," is transmitting the applications across networks, such as for example the Internet. As network traffic continues to increase, it is desirable to reduce the size of Java applications to reduce the time and resources required for transmitting and storing the Java applications.
In addition, it would also be desirable for Java software developers to make it more difficult for others to reverse-engineer their Java applications. After spending large amounts of time and resources developing a software program, developers do not want to place their applications in the public domain in a form that gives away their efforts. However, the "good design" practice of using meaningful names for identifiers is Java applications has the consequence of rendering the Java applications more easily understandable and comprehensible to others.